package com.zk.mockito.cases;

import org.junit.Test;

import java.util.LinkedList;

import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;

public class Case005_1_StubbingVoidMethodsWithExceptions {
    @Test
    public void testStubbingVoidMethodsWithExceptions(){
        //You can mock concrete classes, not just interfaces
        LinkedList mockedList = mock(LinkedList.class);
        doThrow(new RuntimeException()).when(mockedList).clear();

        //following throws RuntimeException:
        mockedList.clear();
    }
}
